import { createRouter, createWebHistory, RouterOptions, Router, RouteRecordRaw } from 'vue-router'

// RouteRecordRaw 是路由组件对象
const routes: RouteRecordRaw[] = [
    {
        path: '/',
        name: 'Home',
        component: () => import('@/views/home.vue')
    },
    {
        path: '/search',
        name: 'Search',
        component: () => import('@/views/search.vue')
    },
    {
        path: '/detail',
        name: 'Detail',
        component: () => import('@/views/detail.vue')
    }
]

// RouterOptions 是路由选项类型
const options: RouterOptions = {
    history: createWebHistory('demo'),
    routes,
}

// Router 是路由对外类型
const router: Router = createRouter(options)

export default router